package com.liuhe.instant;

import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;

public class Demo1 {
    public static void main(String[] args) {
        //时间戳
        Instant now = Instant.now(); //标准时间
        System.out.println(now);
        //根据过了多久
        Instant instant = Instant.ofEpochSecond(1);
        System.out.println(instant);
        //指定时区获取时间
        ZonedDateTime zonedDateTime = now.atZone(ZoneId.of("Asia/Shanghai"));
        System.out.println(zonedDateTime);
        //增减时间
        Instant instant1 = Instant.ofEpochMilli(10000000000L);
        Instant minus = instant1.minusSeconds(10000L);
        System.out.println(minus);


    }
}
